import request from '@/utils/request'

// 当前上架商品
export function listingCommodity() {
  return request({
    url: '/pay/commodity/listing',
    method: 'get'
  })
}

// 查询商品列表
export function listCommodity(param) {
  return request({
    url: `/pay/commodity/list`,
    method: 'get',
    params: param
  })
}

// 商品详情
export function getCommodityDetail(id) {
  return request({
    url: `/pay/commodity/detail/${id}`,
    method: 'get'
  })
}

// 新增商品
export function addCommodity(commodity) {
  return request({
    url: '/pay/commodity/add',
    method: 'post',
    data: commodity
  })
}
/**
 * 修改商品上下架状态
 * @param id 商品id
 * @param status  上下架状态
 * @returns {AxiosPromise}
 */
export function updateCommodityStatus(id,status) {
  return request({
    url: `/pay/commodity/updateStatus/${id}/${status}`,
    method: 'post'
  })
}
// 删除商品
export function deleteCommodity(id) {
  return request({
    url: `/pay/commodity/delete/${id}`,
    method: 'post'
  })
}

// 订单列表
export function listOrder(query) {
  return request({
    url: '/pay/order/list',
    method: 'get',
    params: query
  })
}

// 订单详情
export function getOrderDetail(id) {
  return request({
    url: `/pay/order/detail/${id}`,
    method: 'get'
  })
}

/**
 * 支付日志列表
 * @returns {AxiosPromise}
 * @constructor
 */
export function PaymentList(query) {
  return request({
    url: `/pay/payment/list`,
    method: 'get',
    params: query
  })
}


export function RefundList(query) {
  return request({
    url: `/pay/refund/list`,
    method: 'get',
    params: query
  })
}
